<?php


namespace app\shop_admin\validate;


use think\Validate;

class ReceiptsValidate extends Validate
{
    protected $rule = [
        'config' => 'require|array',
        'config.voice' => 'require',
        'config.user' => 'require|array',
        'config.user.mobile' => 'require|in:1,0',
        'config.user.remake' => 'require|in:1,0',
        'config.user.user_name' => 'require|in:1,0',
        'config.order' => 'require|array',
        'config.order.order_no' => 'require|in:1,0',
        'config.order.create_time' => 'require|in:1,0',
        'config.order.pay_time' => 'require|in:1,0',
        'config.order.receiving_time' => 'require|in:1,0',
        'config.bottom' => 'require|max:128',
        'config.header' => 'require|array',
        'config.header.company' => 'require|in:1,0',
        'config.commodity' => 'require|array',
        'config.commodity.goods' => 'require|array',
        'config.commodity.goods.name' => 'require|in:1,0',
        'config.commodity.goods.count' => 'require|in:1,0',
        'config.commodity.goods.money' => 'require|in:1,0',
        'config.commodity.total' => 'require|in:1,0',
        'config.commodity.freight' => 'require|in:1,0',
        'config.commodity.pay_price' => 'require|in:1,0',
        'config.commodity.reduction' => 'require|in:1,0',
        'config.receiving' => 'require|array',
        'config.receiving.iphone' => 'require|in:1,0',
        'config.receiving.address' => 'require|in:1,0',
        'config.receiving.consignee' => 'require|in:1,0',
        'config.shop' => 'require|array',
        'config.shop.qrcode' => 'require',
        'config.shop.mobile' => 'require|in:1,0',
        'config.shop.address' => 'require|in:1,0',
        'name' => 'require|max:64',
        'printer_no' => 'require|max:64',
        'client_id' => 'require|max:64',
        'client_secret' => 'require|max:64',
        'printer_secret' => 'max:64',
        'configure' => 'require|array',
        'configure.place' => 'require|in:1,0',
        'configure.receiving' => 'require|in:1,0',
        'configure.pay' => 'require|in:1,0',
        'template_id' => 'require|integer',
        'printer_id' => 'require|integer',
        'number' => 'require|integer',
    ];
    protected $message = [
        'config.require' => '配置未上传',
        'config.array' => '配置格式错误',
        'config.voice' => '提示信息不能为空',
        'config.user' => '用户配置未配置或者配置错误',
        'config.user.mobile' => '用户联系方式未配置或配置错误',
        'config.user.remake' => '用户备注未配置或者配置错误',
        'config.user.user_name' => '用户昵称未配置或者配置错误',
        'config.order' => '订单配置未配置或者配置错误',
        'config.order.order_no' => '订单号未配置或者配置错误',
        'config.order.create_time' => '订单创建时间未配置或者配置错误',
        'config.order.pay_time' => '订单支付时间未配置或者配置错误',
        'config.order.receiving_time' => '订单收货时间未配置或者配置错误',
        'config.bottom' => '底部信息未配置',
        'config.header' => '头部信息配置错误',
        'config.header.company' => '商家名称未配置或者配置错误',
        'config.commodity' => '商品配置为配置或者配置错误',
        'config.commodity.goods' => '商品信息未配置或者配置错误',
        'config.commodity.goods.name' => '商品名称未配置或者配置错误',
        'config.commodity.goods.count' => '商品数量未配置或者配置错误',
        'config.commodity.goods.money' => '商品价格未配置或者配置错误',
        'config.commodity.total' => '合计未配置或者配置错误',
        'config.commodity.freight' => '运费未配置或者配置错误',
        'config.commodity.pay_price' => '支付金额未配置或者配置错误',
        'config.commodity.reduction' => '优惠金额未配置或者配置错误',
        'config.receiving' => '收货人信息未配置或者配置错误',
        'config.receiving.iphone' => '收货人号码未配置或者配置错误',
        'config.receiving.address' => '收货人地址未配置或者配置错误',
        'config.receiving.consignee' => '收货人姓名未配置或者配置错误',
        'config.shop' => '商家信息配置未配置或者配置错误',
        //'config.shop.qrcode' => '二维码未配置',
        'config.shop.mobile' => '商家联系方式未配置或者配置错误',
        'config.shop.address' => '商家地址未配置或者配置错误',
        'name.require' => '名称不能为空',
        'printer_no.require' => '终端号不能为空',
        'client_id.require' => '应用ID不能为空',
        'client_secret.require' => '应用秘钥不能为空',
        'name.max' => '名称超出最大限度',
        'printer_no.max' => '终端号超出最大限度',
        'client_id.max' => '应用ID超出最大限度',
        'client_secret.max' => '应用秘钥超出最大限度',
        'printer_secret.max' => '打印机秘钥超出最大限度',
        'configure.require' => '配置不能为空',
        'configure.array' => '配置参数格式错误',
        'configure.place' => '配置参数错误',
        'configure.receiving' => '配置参数错误',
        'configure.pay' => '配置参数错误',
        'template_id' => '模板必须选择',
        'printer_id' => '打印机必须选择',
        'number' => '打印数量必填',
    ];
    protected $scene = [
        'create' => [
            'name',
            'config', 'config.user', 'config.user.mobile', 'config.user.remake', 'config.user.user_name', 'config.order', 'config.order.order_no', 'config.order.create_time',
            'config.order.pay_time', 'config.order.receiving_time', 'config.bottom', 'config.header', 'config.header.company', 'config.commodity', 'config.commodity.goods',
            'config.commodity.goods.name', 'config.commodity.goods.count', 'config.commodity.goods.money', 'config.commodity.total', 'config.commodity.freight',
            'config.commodity.pay_price', 'config.commodity.reduction', 'config.receiving', 'config.receiving.iphone', 'config.receiving.address', 'config.receiving.consignee',
            'config.shop', 'config.shop.qrcode', 'config.shop.mobile', 'config.shop.address','config.voice'
        ],
        'update' => [
            'config', 'config.user', 'config.user.mobile', 'config.user.remake', 'config.user.user_name', 'config.order', 'config.order.order_no', 'config.order.create_time',
            'config.order.pay_time', 'config.order.receiving_time', 'config.bottom', 'config.header', 'config.header.company', 'config.commodity', 'config.commodity.goods',
            'config.commodity.goods.name', 'config.commodity.goods.count', 'config.commodity.goods.money', 'config.commodity.total', 'config.commodity.freight',
            'config.commodity.pay_price', 'config.commodity.reduction', 'config.receiving', 'config.receiving.iphone', 'config.receiving.address', 'config.receiving.consignee',
            'config.shop', 'config.shop.qrcode', 'config.shop.mobile', 'config.shop.address','config.voice'
        ],
        'insert' => ['name','printer_no','client_id','client_secret','printer_secret'],
        'task_create' => ['configure','configure.place','configure.receiving','configure,pay','template_id','printer_id','number']
    ];
}